<?php
  include_once('../conn.php');

  $id = $_POST['id'];
  $position_name = $_POST['position_name'];
  $position_explain = $_POST['position_explain'];
  if(strlen($position_name) < 2) {
    alert('位置名称不能小于2位', 'position_list.php');
    exit();
  }

  $sql = "update position set 
    position_name = '$position_name', 
    position_explain = '$position_explain'
    where id = $id
    ";
  // echo $sql;
  $result = mysqli_query($conn, $sql);
  if($result) {
    alert('位置修改成功', 'position_list.php');
  } else {
    alert('位置修改失败', 'position_list.php');
  }

  mysqli_close($conn);
?>